#include "myDatatype.h"
/*函数指针声明*/
void *(*pInputInfo)();						   /*[输入]通用指针*/
void (*pShowInfo)(void *data);				  /*[输出]通用指针*/
int (*pCompare)(void *data, char *Var); 	 /*[修改]通用指针*/

/*函数原型声明*/
/*链表操作*/
struct Node *CreateHead();												  /*头指针初始化*/
struct Node *FindTail(struct Node *phead);							 	 /*查找尾结点*/
struct Node *AddList(struct Node *phead, void *(*pInputInfo)());		/*尾插法建立链表*/
void Release(struct Node *phead);									   /*释放链表*/
void Traversal(struct Node *phead, void (*pShowInfo)(void *data));	  /*遍历链表并输出数据*/

/*输入数据*/
void *InputSup();				 /*供应商数据输入*/
void *InputCom();				/*商品数据输入*/
void *InputSta();			   /*员工数据输入*/
void *InputMasterPur();		  /*主表数据输入*/
void *InputDetailPur();		 /*细表数据输入*/

/*输出数据*/
void ShowSup(void *data);	        /*供应商数据输出*/
void ShowCom(void *data); 	       /*商品数据输出*/
void ShowSta(void *data);	      /*员工数据输出*/
void ShowMasterPur(void *data);  /*采购主表数据输出*/
void ShowDetailPur(void *data); /*采购主表数据输出*/

/*修改数据*/
void Change(struct Node *phead, struct Node *pnew, char *Var, int (*pCompare)(void *data, char *Var));	

/*删除数据*/
struct Node *Delete(struct Node *phead, char *Var, int (*pCompare)(void *data, char *Var));	

/*比较数据*/
int CompareSupNo(void *data, char *Var);			   /*比较[供应商编号]与手动输入的字符串*/
int CompareSupName(void *data, char *Var);			  /*比较[供应商名称]与手动输入的字符串*/
int CompareSupAddress(void *data, char *Var);		 /*比较[地址]与手动输入的字符串*/
int CompareComNo(void *data, char *Var);			/*比较[商品编号]与手动输入的字符串*/
int CompareComName(void *data, char *Var);		   /*比较[商品名称]与手动输入的字符串*/
int CompareStaNo(void *data, char *Var);		  /*比较[员工编号]与手动输入的字符串*/
int CompareStaName(void *data, char *Var);		 /*比较[员工姓名]与手动输入的字符串*/
int CompareStaPassword(void *data, char *Var);  /*比较[员工密码]与手动输入的字符串*/
int CompareMasterPurNo(void *data, char *Var); /*比较[采购清单号]与手动输入的字符串*/
int CompareDetailPurNo(void *data, char *Var);/*比较[采购明细号]与手动输入的字符串*/

int CompareOuterStaNo(void *firstData, void *secondData);	      /*比较员工编号和采购主表的员工编号是否一致*/
int CompareOuterComNo(void *firstData, void *secondData);	     /*比较商品编号和采购细表的商品编号是否一致*/
int CompareOuterMasterPurNo(void *firstData, void *secondData);	/*比较采购清单号和采购细表的采购清单号是否一致*/


/*读取文件*/
struct Node *ReadSup(struct Node *phead, FILE *fp); 	    /*读取供应商信息*/
struct Node *ReadCom(struct Node *phead, FILE *fp);	   	   /*读取商品信息*/
struct Node *ReadSta(struct Node *phead, FILE *fp);		  /*读取员工信息*/
struct Node *ReadMaster(struct Node *phead, FILE *fp);	 /*读取采购主表信息*/
struct Node *ReadDetail(struct Node *phead, FILE *fp);	/*读取采购细表信息*/

/*写入文件*/
void WriteSup(struct Node* phead, FILE* fp);	  	    /*写入供应商信息*/
void WriteCom(struct Node* phead, FILE* fp);		   /*写入商品信息*/
void WriteSta(struct Node* phead, FILE* fp);		  /*写入员工信息*/
void WriteMaster(struct Node* phead, FILE* fp);		 /*写入采购主表信息*/
void WriteDetail(struct Node* phead, FILE* fp);		/*写入采购细表信息*/

